#include <iostream>
using namespace std;

long long stk[1000], i = 0;
char ch;
long long res;
int main()
{
    ch = getchar();
    while (ch != '@')
    {
        switch (ch)
        {
        case '.':
            i++;
            ch = getchar();
            continue;
        case '+':
            i--;
            stk[i - 1] = stk[i - 1] +
                         stk[i];
            break;
        case '-':
            i--;
                stk[i - 1] = stk[i - 1] - stk[i];
            break;
        case '*':
            i--;
            stk[i - 1] = stk[i] * stk[i - 1];
            break;
        case '/':
            i--;
            stk[i - 1] = stk[i - 1] / stk[i];
            break;
        default:
            break;
        }

        if ('0' <= ch && ch <= '9' )
        {
            res = ch - '0';
            ch = getchar();
            while ('0' <= ch && ch <= '9')
            {
                res *= 10; 
                res += ch - '0';
                ch = getchar();
            }
            stk[i] =res ;
            continue;
        }
        ch = getchar();
    }
    
    printf("%d", stk[0]);
    return 0;
}
